package cn.xfdzx.android.apps.shop.adapter;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

import java.util.List;

import cn.xfdzx.android.apps.shop.R;
import cn.xfdzx.android.apps.shop.bean.AfterSalesListMarketBean;
import cn.xfdzx.android.apps.shop.util.ImageGlideUtil;
import cn.xfdzx.android.apps.shop.widget.CornerImageView;

/**
 * Creator: zf.
 * Date: 2020/9/24.
 * Description:零售-售后列表-内部商品图片适配器.
 */
public class AfterSalesListMarket_InnergoodsAdapter extends BaseQuickAdapter<AfterSalesListMarketBean.DataBean.GoodsBean, BaseViewHolder>  {
    private List<AfterSalesListMarketBean.DataBean.GoodsBean> goodsBeanList;//列表
    public AfterSalesListMarket_InnergoodsAdapter(@Nullable List<AfterSalesListMarketBean.DataBean.GoodsBean> data) {
        super(R.layout.item_afterorder_xfd_goods, data);
    }

    @Override
    public void setData(int index, @NonNull AfterSalesListMarketBean.DataBean.GoodsBean data) {
        super.setData(index, data);
    }


    @Override
    protected void convert(final BaseViewHolder viewHolder, final AfterSalesListMarketBean.DataBean.GoodsBean date) {
        CornerImageView img_goods = viewHolder.getView(R.id.img_goods);
        img_goods.setType(CornerImageView.TYPE_ROUND);

        if (null != date.getGoods_img()) {
            ImageGlideUtil.loadImage(mContext,img_goods,date.getGoods_img());
        }

        viewHolder.setText(R.id.tv_shop_name,date.getGoods_name()+"")
                .setText(R.id.tv_guige,"包装规格：" + date.getGoods_unit())
                .setText(R.id.tv_price,"¥" +date.getGoods_price())
                .setText(R.id.tv_num,"x" +date.getApply_goods_num());
    }
    public void clearDatas(){
        mData.clear();
        notifyDataSetChanged();
    }
    public void refreshDatas(List<AfterSalesListMarketBean.DataBean.GoodsBean> list){
        super.replaceData(list);
    }

}
